package(default_visibility = ["//visibility:public"])

licenses(["notice"])

java_library(
    name = "google_payments_public_keys_manager",
    srcs = ["GooglePaymentsPublicKeysManager.java"],
    deps = [
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_http_client_google_http_client",
        "@tink_java//src/main/java/com/google/crypto/tink/util:keys_downloader",
    ],
)

java_library(
    name = "payment_method_token_hybrid_decrypt",
    srcs = ["PaymentMethodTokenHybridDecrypt.java"],
    deps = [
        ":payment_method_token_constants",
        ":payment_method_token_recipient_kem",
        ":payment_method_token_util",
        "@maven//:com_google_code_gson_gson",
        "@tink_java//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:bytes",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:hkdf",
    ],
)

java_library(
    name = "payment_method_token_sender",
    srcs = ["PaymentMethodTokenSender.java"],
    deps = [
        ":payment_method_token_constants",
        ":payment_method_token_hybrid_encrypt",
        ":payment_method_token_util",
        "@maven//:com_google_code_gson_gson",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@tink_java//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "@tink_java//src/main/java/com/google/crypto/tink:public_key_sign",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:ecdsa_sign_jce",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
    ],
)

java_library(
    name = "payment_method_token_recipient_key_gen",
    srcs = ["PaymentMethodTokenRecipientKeyGen.java"],
    deps = [
        ":payment_method_token_constants",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
    ],
)

java_library(
    name = "payment_method_token_constants",
    srcs = ["PaymentMethodTokenConstants.java"],
    deps = [
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:enums",
    ],
)

java_library(
    name = "payment_method_token_recipient_kem",
    srcs = ["PaymentMethodTokenRecipientKem.java"],
)

java_library(
    name = "payment_method_token_hybrid_encrypt",
    srcs = ["PaymentMethodTokenHybridEncrypt.java"],
    deps = [
        ":payment_method_token_constants",
        ":payment_method_token_util",
        "@maven//:com_google_code_gson_gson",
        "@tink_java//src/main/java/com/google/crypto/tink:hybrid_encrypt",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:ecies_hkdf_sender_kem",
    ],
)

java_library(
    name = "payment_method_token_recipient",
    srcs = ["PaymentMethodTokenRecipient.java"],
    deps = [
        ":google_payments_public_keys_manager",
        ":payment_method_token_constants",
        ":payment_method_token_hybrid_decrypt",
        ":payment_method_token_recipient_kem",
        ":payment_method_token_util",
        "@maven//:com_google_code_gson_gson",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:joda_time_joda_time",
        "@tink_java//src/main/java/com/google/crypto/tink:hybrid_decrypt",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:ecdsa_verify_jce",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
    ],
)

java_library(
    name = "sender_intermediate_cert_factory",
    srcs = ["SenderIntermediateCertFactory.java"],
    deps = [
        ":payment_method_token_constants",
        ":payment_method_token_util",
        "@maven//:com_google_code_gson_gson",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@tink_java//src/main/java/com/google/crypto/tink:public_key_sign",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:ecdsa_sign_jce",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
    ],
)

java_library(
    name = "payment_method_token_util",
    srcs = ["PaymentMethodTokenUtil.java"],
    deps = [
        ":payment_method_token_constants",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:base64",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:bytes",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:elliptic_curves",
        "@tink_java//src/main/java/com/google/crypto/tink/subtle:subtle_util_cluster",
    ],
)
